home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / answers / comp / object-faq / part1 < prev    next >
Text File  |  1993-12-15  |  60KB  |  1,196 lines

  1. Newsgroups: comp.object,comp.answers,news.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!nic.hookup.net!swrinde!cs.utexas.edu!howland.reston.ans.net!agate!msuinfo!uchinews!news
  3. From: Bob Hathaway <rjh@geodesic.com>
  4. Subject: Comp.Object FAQ Version 1.0.5 (12-13) Part 1/8
  5. Message-ID: <1993Dec14.043920.17948@midway.uchicago.edu>
  6. Followup-To: comp.object
  7. Summary: Frequently Asked Questions (FAQ) List and Available Systems For Object-Oriented Technology
  8. Sender: news@uchinews.uchicago.edu (News System)
  9. Organization: Geodesic Systems
  10. Date: Tue, 14 Dec 1993 04:39:20 GMT
  11. Approved: news-answers-request@MIT.Edu
  12. Lines: 1181
  13. Xref: senator-bedfellow.mit.edu comp.object:13848 comp.answers:2989 news.answers:15747
  14.  
  15. Archive-name: object-faq/part1
  16. Last-Modified: 12/13/93
  17. Version: 1.0.5
  18.  
  19. COMP.OBJECT FAQ
  20. Version: 1.0.5
  21. Date:    12/13/1993
  22.  
  23.  
  24. Author:
  25.   Bob Hathaway
  26.   Geodesic Systems
  27.   rjh@geodesic.com
  28.  
  29.  
  30. Anonymous FTP Sites and Hypertext Server:
  31.   anonymous@zaphod.uchicago.edu:/pub/comp.object-faq.1.0.5(.Z) (128.135.72.61)
  32.   anonymous@rtfm.mit.edu:/pub/usenet/comp.object/*_Part_*
  33.   http://cui_www.unige.ch/OSG/FAQ/OO-FAQ/index.html
  34.  
  35. Mail Server:  (See also section 1.24)
  36.   mail mail-server@rtfm.mit.edu
  37.   Subject:
  38.   send usenet/comp.object/*
  39.  
  40. Zaphod is preferred over rtfm for anonymous ftp retrieval, as it provides a
  41. single file.  Rtfm contains the FAQ as posted.
  42.  
  43. To use the hypertext system, see APPENDIX E, entries 27.
  44. There is currently no comp.object archive.
  45.  
  46.  
  47. Copyright 1992-1994  Bob Hathaway
  48. All rights reserved.
  49.  
  50. Permission is granted to freely copy and distribute this document but only at
  51. no cost to others and with the exception of a nominal distribution fee, if
  52. any.  No sale, resale or reprinting is granted without the explicit written
  53. permission of the author.
  54.  
  55. Contributors:  Per Abrahamsen, Stewart Clamen, Edwardo Casais, Dennis De
  56.   Champeaux, Mike DeVaney, Eric Dujardin, Piercarlo Grandi, Brian Henderson-
  57.   Sellers, Urs Hoelzle, Paul Johnson, Bill Kinnersley, James Odell, Eoin Woods
  58.   and many others whose contributions have helped this document to fulfull its
  59.   objective of bringing object-oriented concepts and systems to everyone.
  60.  
  61. Objective:
  62.   In the spirit of other FAQs, to provide a simple document to answer the most
  63.   frequently asked and recurring questions and to allow new users to understand
  64.   frequently discussed topics and terms used in comp.object.   This should
  65.   bring new comp.object readers and/or writers to at least an introductory
  66.   level of comprehension as soon as possible.  Other goals (hopes) are to
  67.   provide a quick and current reference on available systems such as object-
  68.   oriented languages, CASE, OODB and etc. and to provide good references to
  69.   current and relevant OO systems, groups, texts and literature.
  70.  
  71. Disclaimer:
  72.   This document does not necessarily reflect the opinions of the author's or
  73.   any contributor's companies.  There are no explicit or implicit guarantees
  74.   implied by this document.
  75.  
  76. While object systems are a constantly changing and moving target with a broad
  77. diversity of often conflicting methodologies, constructs, terminologies,
  78. approaches, languages, implementations and etc. and comp.object has a wide
  79. diversity of readers and writers ranging from students, professors and
  80. researchers in academia to beginners, professionals, top-notch experts and
  81. leaders in industry with a broad range of experience and backgrounds ranging
  82. across many paradigms, this FAQ can certainly not aspire to satisfy all of them
  83. completely but instead attempts to provide the most well-rounded treatment of
  84. object-oriented concepts and realizations primarily from the mainstream and
  85. popular authors and systems and further to provide a collection of available
  86. systems and tools in the appendices.
  87.  
  88. It should be understood that it is not possible to present a complete,
  89. unbiased, and perfect document on the subject to be everything to all
  90. people; however, herein lies at least one effort to provide a reasonable
  91. compromise.
  92.  
  93. Several improvements are planned for future FAQs, including a glossary.
  94.  
  95.  
  96. SECTION 1:  BASICS
  97.   1.1)  What Is An Object?
  98.   1.2)  What Is Object Encapsulation (Or Protection)?
  99.   1.3)  What Is A Class?
  100.   1.4)  What Is A Meta-Class?
  101.   1.5)  What Is The Infinite Regress Of Objects And Classes?
  102.   1.6)  What are MOPs and Reflection?
  103.   1.7)  What Is Inheritance?
  104.   1.8)  What Is Multiple Inheritance?
  105.   1.9)  Does Multiple Inheritance Pose Any Additional Difficulties?
  106.   1.10) What Is Dynamic Inheritance?
  107.   1.11) What Is Shared (Repeated) Inheritance?
  108.   1.12) Why Use Inheritance?
  109.   1.13) Why Don't Some People Like Inheritance?
  110.   1.14) What Is Specialization/Generalization/Overriding?
  111.   1.15) What Is The Difference Between Object-Based And Object-Oriented?
  112.   1.16) Is A Class An Object?
  113.   1.17) Is An Object A Class?
  114.   1.18) What Is A Method? (And Receiver And Message)
  115.   1.19) What Are Multi-Methods And Multiple-Polymorphism?
  116.   1.20) What Is OOP?
  117.   1.21) What Is OOA/OOD (And Where Can I Get What I Need On It)?
  118.   1.22) Where Did Object-Orientation Come From?
  119.   1.23) What Are The Benefits Of Object-Orientation?
  120.   1.24) What Other FAQs Are available?
  121.  
  122. SECTION 2:  TYPING
  123.   2.1)  What Is Polymorphism?
  124.   2.2)  What Does Polymorphism Boil Down To In OO Programming Languages?
  125.   2.3)  What Is Dynamic Binding?
  126.   2.4)  Is There A Difference Between Being A Member Or Instance Of A Class?
  127.   2.5)  What Is This I Read About ML And Functional Programming Languages?
  128.   2.6)  What Is the Difference Between Static And Dynamic Typing?
  129.   2.7)  What Is A Separation Between Type And Class (Representation)?
  130.   2.8)  What Are Generics And Templates?
  131.  
  132. SECTION 3:  GENERAL
  133.   3.1)  What Is The "Classical" Object-Oriented Paradigm?
  134.   3.2)  What Is The "Delegation/Prototyping" Object-Oriented Paradigm?
  135.   3.3)  Are There Any Other Object-Oriented Paradigms?
  136.   3.4)  What Are The Major Object-Oriented Programming Languages Today?
  137.   3.5)  What Are Object-Oriented Databases And Persistence?
  138.   3.6)  What Are Object-Oriented Operating Systems?
  139.   3.7)  What Are The Current Object-Oriented Methodologies?
  140.   3.8)  What Is The OMG/OMA/ORB/CORBA?
  141.   3.9)  Why Is Garbage Collection A Good Thing?
  142.   3.10) What Can I Do To Teach OO To The Kids?
  143.   3.11) What Is Available On Object-Oriented Testing?
  144.   3.12) What Distributed Systems Are Available?
  145.   3.13) What Is The MVC Framework?
  146.   3.14) What is Real-Time?
  147.  
  148. SECTION 4:  COMMONLY ASKED LANGUAGE SPECIFIC QUESTIONS
  149.   4.1)  What Is Downcasting?
  150.   4.2)  What Are Virtual Functions?
  151.   4.3)  Can I Use Multiple-Polymorphism Or Multi-Methods In C++?
  152.   4.4)  Can I Use Dynamic Inheritance In C++?
  153.  
  154. ANNOTATED BIBLIOGRAPHY
  155.  
  156. APPENDIXES
  157.   APPENDIX A  VIPS
  158.   APPENDIX B  OBJECT-ORIENTED DATABASES AND VENDORS
  159.   APPENDIX C  OBJECT-ORIENTED LANGUAGES AND VENDORS
  160.   APPENDIX D  OBJECT-ORIENTED CASE (OOA/D/P TOOLS) AND VENDORS
  161.   APPENDIX E  ANONYMOUS FTP SITES
  162.   APPENDIX F  MAGAZINES, JOURNALS AND NEWSLETTERS
  163.  
  164. [Another appendix on miscellaneous commercial object-oriented systems should
  165.  be added soon for completeness]
  166.  
  167.  
  168. SECTION 1:  BASICS
  169. ==================
  170.  
  171. Suggested Readings:
  172.   [Booch 91, 94]
  173.   Others to be added...
  174.  
  175.  
  176. 1.1) What Is An Object?
  177. -----------------------
  178.  
  179. There are many definitions of an object, such as found in [Booch 91, p77]:
  180. "An object has state, behavior, and identity; the structure and behavior of
  181. similar objects are defined in their common class; the terms instance and
  182. object are interchangeable".  This is a "classical languages" definition, as
  183. defined in [Coplien 92, p280], where "classes play a central role in the
  184. object model", since they do not in prototyping/delegation languages.  
  185. "The term object was first formally applied in the Simula language, and
  186. objects typically existed in Simula programs to simulate some aspect of
  187. reality" [Booch 91, p77].  Other definitions referenced by Booch include
  188. Smith and Tockey: "an object represents an individual, identifiable item,
  189. unit, or entity, either real or abstract, with a well-defined role in the
  190. problem domain." and [Cox 91]: "anything with a crisply defined boundary"
  191. (in context, this is "outside the computer domain".  A more conventional
  192. definition appears on pg 54).  Booch goes on to describe these definitions
  193. in depth.  [Martin 92, p 241] defines: "An "object" is anything to which a
  194. concept applies", and "A concept is an idea or notion we share that applies
  195. to certain objects in our awareness".  [Rumbaugh 91] defines: "We define an
  196. object as a concept, abstraction or thing with crisp boundaries and meaning for
  197. the problem at hand." [Shlaer 88, p 14] defines: "An object is an abstraction
  198. of a set of real-world things such that:
  199.   * all of the real-world things in the set - the instances - have the same
  200.     characteristics
  201.   * all instances are subject to and conform to the same rules"
  202. and on identifying objects: "What are the *things* in this problem?  Most of
  203. the things are likely to fall into the following five categories: Tangible
  204. things, Roles, Incidents, Interactions, and Specifications."  [Booch 91, 4.3]
  205. covers "Identifying Key Abstractions" for objects and classes based on an
  206. understanding of the problem domain and [Jacobson 92] provides a novel approach
  207. to identifying objects through use-cases.
  208.  
  209. The implementation of objects could roughly be categorized into descriptor-
  210. based, capability-based, and simple static-based approaches.  Descriptor-
  211. based approaches (e.g. Smalltalk handles) allow powerful dynamic typing, as
  212. do the capability-based approaches which are typically found in object-
  213. oriented databases and operating systems (object id's).  A "proxy" based
  214. approach with an added layer of indirection to Smalltalk's handles is found
  215. in Distributed Smalltalk which allows transparent, distributed, and migrating
  216. objects [Kim 89, ch 19 and Yaoqing 93].  Simple static approaches are found
  217. in languages such as C++, although the new RTTI facility will supply simple
  218. dynamic typing, which is also present in new versions of Eiffel.
  219.  
  220. Descriptor-based approaches can have pointer semantics and can be statically
  221. typeless (or just "typeless", as in Smalltalk) where references (variables)
  222. have no type, but the objects (values) they point to always do.  An untyped
  223. pointer (such as void* in C++) and an embedded dynamic typing scheme are used
  224. in more conventional languages to fully emulate this style of dynamically typed
  225. programming (see sections 2.3, 4.3, and [Coplien 92]).
  226.  
  227. Below is a simple example to show a most trivial case of OO implementation.
  228. It is primarily intended to introduce new terms.  See [Cardelli 85] for
  229. another semantic definition of OO using functions for methods and for
  230. a view of types as sets of values.
  231.  
  232. Simple statically-typed objects (static and auto vars and temps in C++ and
  233. expanded types in Eiffel) can be viewed as instances of a record type,
  234. whose record fields are called instance variables (Smalltalk) or member data
  235. (C++).  The record (class) may also contain operations which are called
  236. methods (Smalltalk) or member functions (C++) which are equivalent to a
  237. function taking an object of the record type, called the receiver, as the
  238. first parameter.  The receiver is called self (Smalltalk) or this (C++).
  239. Members will denote both instance variables and methods.  Inheritance is
  240. roughly equivalent to a loosely coupled variant record, with derived classes
  241. as variant parts and with multiple-inheritance concatenating several records
  242. to serve as a base.
  243.  
  244. A virtual member in statically typed languages is a base class member that can
  245. be set or respecified by a derived class.  This is roughly equivalent to a
  246. pointer or function pointer in the base class being set by the derived class.
  247. [Stroustrup 90] covers the implementation details of virtual member functions
  248. in C++, which also involve an offset for the receiver to handle multiple-
  249. inheritance.  This is an example of dynamic binding, which replaces a
  250. switch statement on variant parts with a single call, reducing code size
  251. and program complexity (fewer nested programming constructs) and allowing
  252. variants to be added without modifying client code (which causes higher defect
  253. injection rates during maintanance and debugging).
  254.  
  255. Virtual members in dynamically typed languages are more flexible because
  256. static typechecking requirements are dropped.  See section 2.5.
  257.  
  258. The terms method/member function, instance variable/member data, subclass/
  259. derived class, parent class/base class, and etc. will be used interchangeably.
  260. As pointed out in [Stroustrup 90, p197], the base/derived class terminology
  261. may be preferable to the sub/super-class terminology, and is preferred in
  262. this document also.
  263.  
  264. Delegation/prototyping languages [Kim 89, ch3; Ungar 87, Sciore 89] have a more
  265. flexible kind of object which can play the role of classes in classical OO
  266. languages.  Since there is no separate class construct in these languages, and
  267. only objects, they are referred to as single-hierarchy, or 1 Level systems.
  268. Objects contain fields, methods and delegates (pseudo parents), whereas
  269. classical object-oriented languages associate method, field and parent
  270. definitions with classes (and only associate state and class with objects,
  271. although vtables of function pointers for dynamic binding is an exception).
  272. However, one-level objects often play the role of classes to take advantage of
  273. sharing and often instances will simply delegate to parents to access methods
  274. or shared state, otherwise idiosyncratic objects, a powerful and natural
  275. concept, will result.  Typical 1 Level objects can contain any number of
  276. fields, methods and parents and any object can be used as a template/exemplar,
  277. thus performing the classical role of a class.  In typical prototyping systems,
  278. parents (as any other member) can be added or changed dynamically, providing
  279. dynamic multiple inheritance (or more typically simple delegation).  Here, the
  280. term "Prototype" usually refers to prototype theory, a recent theory of
  281. classification where any object can be inherited from or cloned to serve as a
  282. prototype for newly created instances.  [The Author also uses the term for
  283. languages providing high quality support for rapid prototyping, although this
  284. usage is atypical]  See [Booch 94, pp 154-155] for a brief discussion of
  285. prototype theory in the context of OOA and OOD.
  286.  
  287. It is common in such systems for an object to "become" another kind of object
  288. by changing its parent.  A good example is a window becoming an icon, since
  289. window and icon objects display different behavior (although cognitive
  290. differences are significant too:-)  Delegation refers to delegating the
  291. search for an attribute to a delegate, and is therefore more of a pure
  292. message passing mechanism (as with dynamic scoping) than inheritance, which
  293. also typically specifies non-shared state when used for representation.
  294.  
  295. Chambers has proposed an interesting variation called "Predicate Classes"
  296. [Chambers 93] as a part of his Cecil language.  These classes will only be
  297. parents when certain predicates are true.  This can support a types/classes
  298. as collections of objects view, which is the same as the types as sets of
  299. values view taken by [Cardelli 85].  [Martin 92] provides some examples of
  300. this view applied during OOA.
  301.  
  302. 1 level systems therefore provide the most flexible and powerful capabilities.
  303. Self is a good example of a delegation-based single hierarchy language [Ungar
  304. 87].
  305.  
  306.  
  307. 1.2)  What Is Object Encapsulation (Or Protection)?
  308. ---------------------------------------------------
  309.  
  310. [Booch 91, p. 45] defines: "Encapsulation is the process of hiding all of the
  311. details of an object that do not contribute to its essential characteristics."
  312.  
  313. [Coad 91, 1.1.2] defines: "Encapsulation (Information Hiding).  A principle,
  314. used when developing an overall program structure, that each component of a 
  315. program should encapsulate or hide a single design decision...  The interface
  316. to each module is defined in such a way as to reveal as little as possible
  317. about its inner workings.  [Oxford, 1986]"
  318.  
  319. Some languages permit arbitrary access to objects and allow methods to be
  320. defined outside of a class as in conventional programming.  Simula and
  321. Object Pascal provide no protection for objects, meaning instance variables
  322. may be accessed wherever visible.  CLOS and Ada allow methods to be defined
  323. outside of a class, providing functions and procedures.  While both CLOS
  324. and Ada have packages for encapsulation, CLOS's are optional while Ada's
  325. methodology clearly specifies class-like encapsulation (Adts).
  326.  
  327. However most object-oriented languages provide a well defined interface to
  328. their objects thru classes.  C++ has a very general encapsulation/protection
  329. mechanism with public, private and protected members.  Public members (member
  330. data and member functions) may be accessed from anywhere.  A Stack's Push and
  331. Pop methods will be public.  Private members are only accessible from within
  332. a class.  A Stack's representation, such as a list or array, will usually be
  333. private.  Protected members are accessible from within a class and also from
  334. within subclasses (also called derived classes).  A Stack's representation
  335. could be declared protected allowing subclass access.  C++ also allows a
  336. class to specify friends (other (sub)classes and functions), that can access
  337. all members (its representation).  Eiffel 3.0 allows exporting access to
  338. specific classes.
  339.  
  340. For another example, Smalltalk's class instance variables are not accessible
  341. from outside of their class (they are not only private, but invisible).
  342. Smalltalk's methods are all public (can be invoked from anywhere), but a
  343. private specifier indicates methods should not be used from outside of the
  344. class.  All Smalltalk instance variables can be accessed by subclasses, 
  345. helping with abstract classes and overriding.
  346.  
  347. Another issue is per-object or per-class protection.  Per-class protection
  348. is most common (e.g. Ada, C++, Eiffel), where class methods can access any
  349. object of that class and not just the receiver.  Methods can only access the
  350. receiver in per-object protection.  This supports a subtyping model, as any
  351. object other than the receiver is only satisfying an abstract type interface,
  352. whereby no method or object structure can be inferred in the general case.
  353.  
  354.  
  355. 1.3  What Is A Class?
  356. --------------------
  357.  
  358. A class is a general term denoting classification and also has a new meaning
  359. in object-oriented methods.  Within the OO context, a class is a specification
  360. of structure (instance variables), behavior (methods), and inheritance
  361. (parents, or recursive structure and behavior) for objects.  As pointed out
  362. above, classes can also specify access permissions for clients and derived
  363. classes, visibility and member lookup resolution.  This is a feature-based or
  364. intensional definition, emphasizing a class as a descriptor/constructor of
  365. objects (as opposed to a collection of objects, as with the more classical
  366. extensional view, which may begin the analysis process).
  367.  
  368. Original Aristotlean classification defines a "class" as a generalization of
  369. objects:
  370. [Booch 91, p93]
  371.   "a group, set, or kind marked by common attributes or a common attribute; a
  372.    group division, distinction, or rating based on quality, degree of
  373.    competence, or condition".
  374.    
  375. [Booch's definition in the context of OOD]
  376.   "A class is a set of objects that share a common structure and a common
  377.   behavior."  "A single object is simply an instance of a class."
  378.  
  379. The intension of a class is its semantics and its extension is its instances
  380. [Martin 92].
  381.  
  382. [Booch 94, 4.2] proposes 3 views of classification as useful in OO analysis and
  383. design: classical categorization (common properties), conceptual clustering
  384. (conceptual descriptions), and prototype theory (resemblance to an exemplar).
  385. He advocates starting with the former approach, turning to the second approach
  386. upon unsatisfactory results, and finally the latter if the first two approaches
  387. fail to suffice.
  388.  
  389.  
  390. 1.4)  What Is A Meta-Class?
  391. ---------------------------
  392.  
  393. [See also section 1.6]
  394.  
  395. A Meta-Class is a class' class.  If a class is an object, then that object
  396. must have a class (in classical OO anyway).  Compilers provide an easy way to
  397. picture Meta-Classes.  Classes must be implemented in some way; perhaps with
  398. dictionaries for methods, instances, and parents and methods to perform all
  399. the work of being a class.  This can be declared in a class named "Meta-Class".
  400. The Meta-Class can also provide services to application programs, such as
  401. returning a set of all methods, instances or parents for review (or even
  402. modification).  [Booch 91, p 119] provides another example in Smalltalk with
  403. timers.  In Smalltalk, the situation is more complex.  To make this easy, refer
  404. to the following listing, which is based on the number of levels of distinct
  405. instantiations:
  406.  
  407. 1 Level System
  408.   All objects can be viewed as classes and all classes can be viewed as
  409.   objects (as in Self).  There is no need for Meta-Classes because objects
  410.   describe themselves.  Also called "single-hierarchy" systems.
  411.   There is only 1 kind of object.
  412. 2 Level System
  413.   All Objects are instances of a Class but Classes are not accessible to
  414.   programs (no Meta-Class except for in the compiler and perhaps for type-safe
  415.   linkage, as in C++).
  416.   There are 2 kinds of distinct objects: objects and classes.
  417. 3 Level System
  418.   All objects are instances of a class and all classes are instances of
  419.   Meta-Class.  The Meta-Class is a class and is therefore an instance of
  420.   itself (really making this a 3 1/2 Level System).  This allows classes to
  421.   be first class objects and therefore classes are available to programs.
  422.   There are 2 kinds of distinct objects (objects and classes), with a
  423.   distinguished class, the metaclass.
  424. 5 Level System
  425.   What Smalltalk provides.  Like a 3 Level System, but there is an extra level
  426.   of specialized Meta-Classes for classes.  There is still a Meta-Class as in 
  427.   a 3 Level System, but as a class it also has a specialized Meta-Class, the
  428.   "Meta-Class class" and this results in a 5 Level System: 
  429.     object
  430.     class
  431.     class class (Smalltalk's Meta-Classes)
  432.     Meta-Class
  433.     Meta-Class class
  434.  
  435.   The "class class"es handle messages to classes, such as constructors and
  436.   "new", and also "class variables" (a term from Smalltalk), which are
  437.   variables shared between all instances of a class (static member data in
  438.   C++).  There are 3 distinct kinds of objects (objects, classes, and
  439.   metaclasses).
  440.  
  441.  
  442. 1.5)  What Is The Infinite Regress Of Objects And Classes?
  443. ----------------------------------------------------------
  444.  
  445. In the authors opinion, a myth.  The story goes an object is an instance of a
  446. class (Meta-Object), a class is an instance of a Meta-Class, which must also
  447. be an instance of a Meta-Meta-Class, which must also be an instance of a Meta-
  448. Meta-Meta-Class, ...  Closure can be achieved with an instance-of loop, as with
  449. a Meta-Class being an instance of itself or with a "Meta-Class - Meta-Class
  450. class" instance-of loop (as in Smalltalk).
  451.  
  452.  
  453. 1.6)  What Are MOPs And Reflection?
  454. -----------------------------------
  455.  
  456. MOP is an acronym for Meta-Object Protocol.  This is a system with
  457. Meta-Classes accessible to users [Kiczales 92].  In CLOS terminology, an
  458. introspective protocol provides a read only capability (e.g. what is this
  459. object's class, give info on this class, etc.) and an intercessory protocol
  460. provides a write capability which allows system modification (e.g. add the
  461. following method or instance to this class, perform inheritance this way,
  462. etc.).  Because inheritance can be used to perform differential changes,
  463. intercessory protocols allow users to not only define new frameworks but
  464. to specialize existing system frameworks differentially without affecting
  465. them and their extant objects.  Thus, many frameworks can interoperate
  466. together simultaneously.  This is a good example of object-oriented reuse,
  467. since the compiler itself is reused thru specialization to provide new
  468. frameworks.
  469.  
  470. "Reflective" systems are systems with MOPs (not to be confused with reflexive
  471. systems, which often refer to systems implemented in terms of themselves, or
  472. bootstrapped).  Reflective systems are inevitably reflexive (as are most
  473. quality compilers), providing a direct program interface to the system.
  474.  
  475.  
  476. 1.7)  What Is Inheritance?
  477. --------------------------
  478.  
  479. Inheritance provides a natural classification for kinds of objects and allows
  480. for the commonality of objects to be explicitly taken advantage of in modeling
  481. and constructing object systems.  See the example below using computers.
  482.  
  483. Inheritance is a relationship between classes where one class is the parent
  484. (base/superclass/ancestor/etc.) class of another.  Inheritance provides
  485. programming by extension (as opposed to programming by reinvention
  486. [LaLonde 90]) and can be used as an is-a-kind-of (or is-a) relationship or
  487. for differential programming.  Inheritance can also double for assignment
  488. compatibility (see section 2.7).
  489.  
  490. In delegation languages, such as Self, inheritance is delegation where objects
  491. refer to other objects to respond to messages (environment) and do not
  492. respecify state by default.
  493.  
  494. Inherited parents can specify various flavors of state.  Delegation languages
  495. don't specify new state by default (to do so requires cloning), C-based (C++,
  496. Eiffel, Objective-C, etc.), lisp-based (CLOS, Flavors, Scheme, etc.), and
  497. Pascal-based (Ada-9x, Modula-3, Object Pascal, etc.) OO languages do, but with
  498. multiple-inheritance can also share parents within a class lattice (CLOS and
  499. Eiffel provide this as a default at the level of slots and features,
  500. respectively).
  501.  
  502. Inheritance also provides for member lookup, or internal environment.  Various
  503. schemes exist, for example C++ finds the closest match within a scope but
  504. causes an ambiguity error iff more than one parent has match, CLOS creates
  505. a linear precedence list, Self provides parent priorities, and Eiffel forces
  506. renaming for any parent member conflicts.
  507.  
  508. Defining inheritance (with a thorough description or denotational semantic
  509. definition, or both) can avoid confusion about which inheritance scheme is
  510. being used (especially in OOD), because inheritance has many variations and
  511. combinations of state and environment (sometimes with complex rules).
  512. Inheritance can also be used for typing, where a type or class can be used to
  513. specify required attributes of a matching object (see sections 2.1, 2.7 and
  514. [Cardelli 85]).  It would be more judicious to have discussions on how
  515. inheritance should be defined instead of over what it is, since it has many
  516. existing uses and semantics.
  517.  
  518. An example of the is-a-kind-of relationship is shown below.  Is-a is often
  519. used synonymously, but can be used to show the "object is-a class"
  520. instantiation relationship.  In classical OO, inheritance is a relationship
  521. between classes only.  In one-level systems, is-a (object instantiation) and
  522. is-a-kind-of (inheritance) are merged into one [Ungar 87, Madsen 93, Sciore
  523. 89].
  524.  
  525.                                Computer
  526.                               /    |     \
  527.                        Mainframe  Mini    Personal
  528.                         /    \    ...       /   \
  529.                   Data Proc  Scientific   PC    Workstation
  530.  
  531. Class hierarchies are subjective [Booch 91, 4.2; Lakoff 87] and usually drawn
  532. with the parent class on top, but more demanding graphs (as is often the case
  533. in [Rumbaugh 91]) allow any topology, with the head of an arrow indicating the
  534. base class and the tail indicating the derived class.
  535.  
  536. Differential programming is the use of inheritance to reuse existing classes
  537. by making a small change to a class.  Creating a subclass to alter a method
  538. or to add a method to a parent class is an example.
  539.  
  540.  
  541. 1.8)  What Is Multiple Inheritance?
  542. -----------------------------------
  543.  
  544. Multiple Inheritance occurs when a class inherits from more than one parent.
  545. For example, a person is a mammal and an intellectual_entity, and a document
  546. may be an editable_item and a kind of literature.
  547.  
  548. Mixin's is a style of MI (from flavors) where a class is created to provide
  549. additional attributes or properties to other classes.  They are intended to be
  550. inherited by any class requiring them.  Method combination, or calling
  551. sequences of before, after, and around methods or even several primary methods
  552. [Kim 89, ch 4], make good use of mixins by invoking their methods without
  553. explicitly calling them, allowing client class code to remain unchanged [Booch
  554. 91, p 113].
  555.  
  556.  
  557. 1.9)  Does Multiple Inheritance Pose Any Additional Difficulties?
  558. -----------------------------------------------------------------
  559.  
  560. Yes, it does.  Any name can be simply resolved to a class member with single
  561. inheritance by simply accessing the first name encountered for data members
  562. and by accessing the first signature match (or ambiguity) encountered for
  563. methods (at least one way, C++ hides some member functions).  Since several
  564. distinct parents can declare a member within a multiple inheritance hierarchy,
  565. which to choose becomes an issue.  Eiffel forces derived classes to rename
  566. parent members that conflict.  Self prioritizes parents.  CLOS merges member
  567. "slots" (instance variables) with the same name into a single slot, as did
  568. the earlier flavors.  C++ declares an error iff a conflict arises, but a
  569. class qualifier can be used to explicitly disambiguate.  Smalltalk renders
  570. same names for instance variables of subclasses illegal.
  571.  
  572. On the other hand, multiple-inheritance can be seen as required for basic
  573. object-oriented programming, because many objects in the real world belong to
  574. several classes.  In classical systems without MI, a class which should inherit
  575. from more than one class must textually include all but one of those classes in
  576. its interface, causing code duplication (and a messy interface).
  577.  
  578.  
  579. 1.10)  What Is Dynamic Inheritance?
  580. -----------------------------------
  581.  
  582. Dynamic inheritance allows objects to change and evolve over time.  Since base
  583. classes provide properties and attributes for objects, changing base classes
  584. changes the properties and attributes of a class.  A previous example was a
  585. window changing into an icon and then back again, which involves changing a
  586. base class between a window and icon class.
  587.  
  588. More specifically, dynamic inheritance refers to the ability to add, delete,
  589. or change parents from objects (or classes) at run-time.  Actors, CLOS, and
  590. Smalltalk provide dynamic inheritance in some form or other.  Single hierarchy
  591. systems, such as Self, provide dynamic inheritance in the form of delegation
  592. [Ungar 87].
  593.  
  594. See also [Kim 89, chs 1, 3] for a discussion and [Coplien 92] for some
  595. implementation discussion in C++.
  596.  
  597.  
  598. 1.11)  What Is Shared (Repeated) Inheritance?
  599. ---------------------------------------------
  600.  
  601. Multiple Inheritance brings up the possibility for a class to appear as a
  602. parent more than once in a class graph (repeated inheritance), and there is
  603. then a potential to share that class.  Only one instance of the class will
  604. then appear in the graph (as is always the case in CLOS, because all *members*
  605. with the same name will be shared (receive a single slot) with the greatest
  606. common subtype as its type).  C++ provides an alternative, where only parents
  607. specified as virtual (virtual bases) are shared within the same class lattice,
  608. allowing both shared and non-shared occurrences of a parent to coexist.  All
  609. "features" in Eiffel (C++ members) of a repeated parent that are not to be
  610. shared must be renamed "along an inheritance path", else they are shared by
  611. default.  This allows a finer granularity of control and consistent name
  612. resolution but requires more work for parents with many features.
  613.  
  614.  
  615. 1.12)  Why Use Inheritance?
  616. ---------------------------
  617.  
  618. Inheritance is a natural way to model the world or a domain of discourse,
  619. and so provides a natural model for OOA and OOD (and even OOP).  This is
  620. common in the AI domain, where semantic nets use inheritance to understand
  621. the world by using classes and concepts for generalization and categorization,
  622. by reducing the real-world's inherent complexity.
  623.  
  624. Inheritance also provides for code and structural reuse.  In the above Computer
  625. class diagram, all routines and structure available in class Computer are
  626. available to all subclasses throughout the diagram.  All attributes available
  627. in Personal computers are also available to all of its subclasses.  This kind
  628. of reuse takes advantage of the is-a-kind-of relationship.  Class libraries
  629. also allow reuse between applications, potentially allowing order-of-magnitude
  630. increases in productivity and reductions in defect rates (program errors),
  631. as library classes have already been tested and further use provides further
  632. testing providing even greater reliability.
  633.  
  634. With differential programming, a class does not have to be modified if it is
  635. close to what's required; a derived class can be created to specialize it.
  636. This avoids code redundancy, since code would have to be copied and modified
  637. otherwise.  See [Raj 89] for an alternative approach as found in Jade.
  638.  
  639. Polymorphism is often explicitly available in many OO languages (such as C++,
  640. CLOS, Eiffel, etc.) based on inheritance when type and class are bound together
  641. (typing based on subclassing, or subclass polymorphism), since only an object
  642. which is a member of (inherits from) a class is polymorphically assignment
  643. compatible with (can be used in place of) instances or references of that
  644. class.  Such assignment can result in the loss of an object's dynamic type in
  645. favor of a static type (or even loss of an object's representation to that of
  646. the static class, as in C++ slicing).  Maintaining the dynamic type of objects
  647. can be provided (and preferred); however, C++ provides both sliced and non-
  648. sliced replacement in a statically typed environment (see section 2.1).
  649.  
  650.  
  651. 1.13)  Why Don't Some People Like Inheritance?
  652. ----------------------------------------------
  653.  
  654. Some people complain that inheritance is hierarchical (which is what most
  655. object-oriented languages provide).  They would also like to see more
  656. operations available (set operations are quite common in specialized systems).
  657. The former is a kind of language dependent feature commonly found in object-
  658. oriented languages which are then associated with the term "inheritance"
  659. (although they don't need to be.  For example, delegation languages allow graph
  660. inheritance stuctures).  Some don't like the coupling of classes (as in Jade),
  661. but in the author's opinion many of their complaints are easily answered.  In
  662. systems that provide inheritance, inheritance provides a simple and elegant way
  663. to reuse code and to model the real world in a meaningful way.
  664.  
  665. Others complain multiple inheritance is too complicated because it brings up
  666. the issues of shared bases and member conflict resolution.  But most modern
  667. systems support Multiple Inheritance by employing semantic resolution
  668. strategies or renaming, and most consider MI to be highly desirable.  See the
  669. latter part of section 1.9 for an example of why MI is important.
  670.  
  671. Some prefer association to MI, claiming "roles" (as defined in [Rumbaugh 91])
  672. should be associations and inheritance should be reserved for a single
  673. hierarchy "creation" mechanism, however this loses polymorphism and loses the
  674. use of inheritance for typical classification.  Representation "roles" can be
  675. supported by dynamic multiple inheritance (DMI) in many situations.
  676.  
  677.  
  678. 1.14)  What Is Specialization/Generalization/Overriding?
  679. --------------------------------------------------------
  680.  
  681. To create a subclass is specialization, to factor out common parts of
  682. derived classes into a common base (or parent) is generalization [Booch 91,
  683. p56].  Overriding is the term used in Smalltalk and C++ for redefining a
  684. (virtual in Simula and C++) method in a derived class, thus providing
  685. specialized behavior.  All routines in Smalltalk and Eiffel are overridable
  686. (although in Eiffel they must be "redefined" in a derived class).  Whenever
  687. a method is invoked on an object of the base class, the derived class method
  688. is executed overriding the base class method, if any.  Overriding in Simula
  689. is a combination of overloading and multiple-polymorphism because parameters do
  690. not have to be declared.  Eiffel and Beta are examples of languages allowing
  691. any member to be redefined and not just methods, as is typical.
  692.  
  693.  
  694. 1.15)  What Is The Difference Between Object-Based And Object-Oriented?
  695. -----------------------------------------------------------------------
  696.  
  697. Object-Based Programming usually refers to objects without inheritance
  698. [Cardelli 85] and hence without polymorphism, as in '83 Ada and Modula-2.
  699. These languages support abstract data types (Adts) and not classes, which
  700. provide inheritance and polymorphism.  Ada-9x and Modula-3; however, support
  701. both inheritance and polymorphism and are object-oriented.  [Cardelli 85, p481]
  702. state "that a language is object-oriented if and only if it satisfies the
  703. following requirements:
  704.  
  705.   - It supports objects that are data abstractions with an interface of named
  706.     operations and a hidden local state.
  707.   - Objects have an associated type.
  708.   - Types may inherit attributes from supertypes.
  709.  
  710.   object-oriented = data abstractions + object types + type inheritance
  711.  
  712. These definitions are also found in [Booch 91, Ch2 and Wegner 87].
  713.  
  714. [Coad 91] provides another model:
  715.  
  716.   Object-Oriented = Classes and Objects 
  717.                     + Inheritance 
  718.                     + Communication with messages
  719.  
  720. Stroustrup's first edition of [Stroustrup 91, '86 p. 37] defines object based
  721. as: "... storing type identification in each object, brings us to a style of
  722. programming often referred to as "object based"", which is quite different
  723. from C+W's.
  724.  
  725. A more modern definition of "object-oriented" includes single-hierarchy
  726. languages and perhaps object id's for unique objects.  Object id's support the
  727. modern notion of relocatable, persistent and distributed objects that can
  728. even migrate across machines.  Distributed Smalltalk's proxy objects [Kim 89,
  729. ch 19 and Yaoqing 93] provide another example of a distributable and migratable
  730. object facility.  Separate type system support is another extension.
  731.  
  732. [Booch 94, 2.2] proposes 7 "Elements of the Object Model"; 4 major and 3 minor:
  733.   Major:
  734.     Abstraction
  735.     Encapsulation
  736.     Modularity
  737.     Hierarchy  (Inheritance)
  738.   Minor:
  739.     Typing
  740.     Concurrency
  741.     Persistence
  742.  
  743.  
  744. 1.16)  Is A Class An Object?
  745. ----------------------------
  746.  
  747. In C++ no, because C++ classes are not instances of an accessible class (a
  748. Meta-Class) and because C++ classes are not accessible to programs.  Classes
  749. are objects in 3 Level Systems and above because classes are instances of
  750. meta-classes.  But classes play a dual role, because objects can only be
  751. declared to be instances of a class (and class objects instances of a
  752. meta-class).  In 1 Level (single-hierarchy) systems, all classes are objects.
  753.  
  754.  
  755. 1.17)  Is An Object A Class?
  756. ----------------------------
  757.  
  758. In a Level 3 System and above yes, but only instances of a Meta-Class are
  759. Classes.  Instances of a Class (ordinary objects) are not classes (excluding
  760. hybrid systems).  However, all objects may be classes in single hierarchy
  761. systems, since any object may act as a class (provide object instantiation or
  762. act as a shared parent).
  763.  
  764.  
  765. 1.18)  What Is A Method? (And Receiver And Message)
  766. ---------------------------------------------------
  767.  
  768. A method implements behavior, which is defined by [Booch 91, p80]:
  769.  
  770.   Behavior is how an object acts and reacts, in terms of its state changes
  771.   and message passing.
  772.  
  773. A method is a function or procedure which is defined in a class and typically
  774. can access the internal state of an object of that class to perform some
  775. operation.  It can be thought of as a procedure with the first parameter as
  776. the object to work on.  This object is called the receiver, which is the object
  777. the method operates on.  An exception exists with C++'s static member functions
  778. which do not have a receiver, or "this" pointer.  The following are some common
  779. notations for invoking a method, and this invocation can be called a message
  780. (or message passing, see below):
  781.  
  782.   receiver.message_name(a1, a2, a3)   
  783.   receiver message_name: a1 parm1: a2 parm3: a3
  784.  
  785. Selector would be another good choice for message_name in the above examples,
  786. although keywords (or formal parameter names, like named parameters) are
  787. considered part of the selector in Smalltalk (and hence Objective-C).
  788.  
  789. If done statically, this can be referred to as invocation, and message passing
  790. if done dynamically (true dynamic binding).  Statically typed dynamic binding
  791. (e.g. C++ and Eiffel) is really in between (checked function pointers).
  792.  
  793. See also section 1.19 below for a discussion on the functional (prefix) verses
  794. message based (receiver based) notation.
  795.  
  796.  
  797. 1.19)  What Are Multi-Methods And Multiple-Polymorphism?
  798. --------------------------------------------------------
  799.  
  800. Multi-methods involve two primary concepts, multiple-polymorphism and lack of
  801. encapsulation.  These issues are orthogonal.  Multiple-polymorphism implies
  802. more than one parameter can be used in the selection of a method.  Lack of
  803. encapsulation implies all arguments can be accessed by a multi-method (although
  804. packages can be used to restrict access, as in CLOS).  Multi-methods can also
  805. imply a functional prefix notation, although the CLOS designers (who coined the
  806. term "multi-method") consider the functional and receiver based forms
  807. (messages) equivalent.  Functional syntax was chosen "in order to minimize the
  808. number of new mechanisms added to COMMON LISP" [Kim ch 4, p70 (D. Moon)].
  809. [Chambers 93] discusses multi-methods in his new OO language, Cecil.
  810.  
  811. Multiple-polymorphism allows specialized functions or methods to be defined to
  812. handle various cases:
  813.  
  814.   +(int, int)
  815.   +(int, float)
  816.   +(int, complex)
  817.   +(int, real)
  818.   +(float, complex)
  819.   +(float, real)
  820.   +(float, float)
  821.  
  822. The above functions are specialized to each of the cases required allowing
  823. single, highly cohesive and loosely coupled functions to be defined.  This is
  824. also the true essence of object-oriented polymorphism, which allows objects to
  825. define methods for each specific case desired.  In addition to better coupling
  826. and cohesion, multiple-polymorphism reduces program complexity by avoiding
  827. coding logic (switch statements) and because small methods further reduce
  828. complexity, as code complexity doesn't grow linearly with lines of code per
  829. method, but perhaps exponentially.  This should be distinguished from double
  830. dispatch, a fancy name for single dispatch after a call, which only provides
  831. switching on a single argument per call (but for 2 levels), consistently
  832. ignoring the inherent type of parameters in messaging.  Double dispatch is
  833. used in languages with static typing for efficiency considerations.
  834.  
  835. If all of the above types are Numbers, code can be written without concern for
  836. the actual classes of objects present:
  837.  
  838.   fn(one, two: Number): Number
  839.     return one + two;
  840.  
  841. The addition expression above will invoke the correct "+" function based on the
  842. inherent (true, actual, or dynamic) types of one and two.  Only the inherent
  843. type of "one" would be used with double dispatch!  In the author's opinion,
  844. this is a serious shortcoming.  Further, double dispatch would only allow
  845. switching to the "fn" function based on the type of "one" also.  This could
  846. lead to the use of switch statements based on type or complex coding in many
  847. real-world programming situations, unnecessarily.  In the author's opinion,
  848. this should only be used as necessary, e.g. if the implementation language
  849. doesn't support multiple-polymorphism and either efficiency considerations
  850. dominate and double dispatch can be suffered, or an embedded dynamic typing
  851. scheme is used.
  852.  
  853. Why do multi-methods allow open access to parameters?  It allows for efficient
  854. handling, like C++ friends, usually by allowing representation details of more
  855. than one object to be exposed.  See [Kim ch 4, pp70-71 (D. Moon)] for an
  856. alternative explanation.  While open access can be useful in some cases, it
  857. typically isn't recommended as a general OO practise (see section 1.15, C+W's
  858. requirement 1 for OO languages) and also violates subtype polymorphism, because
  859. only subclass polymorphism is based on representation and not type.
  860.  
  861. Polymorphic languages can be statically typed to provide strong type checking,
  862. efficiency, and to support a static programming idiom, but require restrictions
  863. in many cases, such as requiring overriding methods to have identical
  864. signatures with the methods they substitute (as in C++) or allowing covariant
  865. parameters but limiting base class usage (as in Eiffel).  If these restrictions
  866. are dropped, multiple-polymorphism results.  Thus a single overridable function
  867. declared in a base class may have several functions overriding it in a derived
  868. class differentiated only by their formal argument types.  This therefore
  869. requires both static and dynamic typing, because no formal argument
  870. differentiation is possible without static types, as in Smalltalk, and no
  871. actual argument differentiation is possible without dynamic types (as in C++
  872. and Eiffel).  See section 2.3 for another example of multiple-polymorphism.
  873.  
  874. There is some concern about the efficiency of run-time method selection as
  875. can occur with multiple-polymorphism (or even dynamic message passing).
  876. However, static analysis optimizations are commonly available in the
  877. literature, potentially providing a single static selection in many cases
  878. [See Agrawal 91, Chambers 92, Mugridge 91, and etc.].
  879.  
  880. But coupling the two cases of selector variables (as found in CLOS,
  881. Objective-C, and etc.) and several possible known selectors together with the
  882. general undecidability of dynamic types at compile-time renders dynamic typing
  883. and run-time selection (or checking) as unavoidable in the general case [a
  884. point often mistaken in comp.object.  E.g. simple statically/strongly typed
  885. multi-methods still require dynamic types!]
  886.  
  887. See [Booch 91], multiple-polymorphism, for a good CLOS example.
  888.  
  889.  
  890. 1.20)  What Is OOP?
  891. -------------------
  892.  
  893. OOP stands for Object-Oriented Programming, the usual programming/hacking and
  894. etc. most programmers think of.  Modern software engineering methodologies;
  895. however, consider OOP as the implementation/evolution of an OOD.
  896.  
  897.  
  898. 1.21)  What Is OOA/OOD (And Where Can I Get What I Need On It)?
  899. ---------------------------------------------------------------
  900.  
  901.   See also section 3.7, the Annotated Bibliography, and APPENDIX D.  The
  902.   classified bibliography in [Booch 94] also contains entries on OOA(B), OOD(F)
  903.   and OOP(G).
  904.  
  905. [Booch 91]
  906.   "In OOA, we seek to model the world by identifying the classes and objects
  907.   that form the vocabulary of the problem domain, and in OOD, we invent the
  908.   abstractions and mechanisms that provide the behavior that this model
  909.   requires."
  910.  
  911. [Coad 91]
  912.   "OOA is the challenge of understanding the problem domain, and then the
  913.   system's responsibilities in that light".
  914.   "To us, analysis is the study of a problem domain, leading to a specification
  915.   of externally observable behavior; a complete, consistent, and feasible
  916.   statement of what is needed; a coverage of both functional and quantified
  917.   operational characteristics (e.g. reliability, availability, performance)".
  918.   "Design.  The practise of taking a specification of externally available
  919.   behavior and adding details needed for actual computer system implementation,
  920.   including human interaction, task management, and data management details."
  921.  
  922. And on Domain Analysis:
  923.  
  924.   "Whereas OOA typically focuses upon one specific problem at a time, domain
  925.    analysis seeks to identify the classes and objects that are common to all
  926.    applications within a given domain, [...]".  - [Booch 91]
  927.  
  928.   [The following quotes on domain analysis are from [Berard 93]]
  929.  
  930.   "An investigation of a specific application area that seeks to identify the
  931.    operations, objects, and structures that commonly occur in software systems
  932.    within this area.  - Dan McNicholl
  933.  
  934.   "Systems analysis states what is done for a specific problem in a domain
  935.    while domain analysis states what can be done in a range of problems in a
  936.    domain.  ...A domain analysis is only useful in many similar systems are to
  937.    be built so that the cost of the domain analysis can be amortized over the
  938.    cost of all the systems.
  939.  
  940.    The key to reusable software is captured in domain analysis in that it
  941.    stresses the reusability of analysis and design, not code. - Jim Neighbors
  942.  
  943.   "The process of identifying, collecting, organizing, and representing the
  944.   relevant information in a domain based on the study of existing systems and
  945.   their development histories, knowledge captured from domain experts,
  946.   underlying theory, and emerging technology within the domain."  - Kang et al.
  947.  
  948.   Object-oriented domain analysis (OODA) seeks to identify reusable items
  949.   localized around objects, e.g., classes, instances, systems of interacting
  950.   objects, and kits [frameworks]. OORA analysts and OOD designers will
  951.   interact on a fairly frequent basis with the domain analysis effort.
  952.  
  953.  
  954. OOA and OOD stand for Object-Oriented Analysis and Object-Oriented Design,
  955. respectively.  OOA strives to understand and model, in terms of object-oriented
  956. concepts (objects and classes), a particular problem within a problem domain
  957. (from its requirements, domain and environment) from a user-oriented or domain
  958. expert's perspective and with an emphasis on modeling the real-world (the
  959. system and its context/(user-)environment).  The product, or resultant model,
  960. of OOA specifies a complete system and a complete set of requirements and
  961. external interface of the system to be built.
  962.  
  963. [Shlaer 88] is often credited as the first book on OOA, although their method
  964. adds OO techniques to the traditional structured analysis principles of Yourdon
  965. and Constantine. Their complete approach ([Shlaer 88, 92]) consists of
  966. information modeling and recursive design, or OOA/RD and represents a recent
  967. addition to the structured analysis family (as does Martin and Odell).
  968. [Yourdon 92] provides a critique, although may only refer to their earlier
  969. work.  Many other methodologies including Rumbaugh's OMT, Martin and Odell's
  970. OOA/D, and many others, also share common ground with SA and other existing
  971. analysis methodologies with such constructs as associations (E-R), functional
  972. models, and even DFD's.  Booch, Jacobson, and Wirfs-Brock are examples of OO
  973. methodologies representing a greater departure from the conventional
  974. "structured" techniques, with greater emphasis on objects.  OOram [Reenskaug
  975.  91] provides support and emphasis on types and roles as guiding principles,
  976. which is quite powerful.  [Booch 94] presents a methodology which is an
  977. evolutionary step beyond the first edition by incorporating a collection of the
  978. best features from several of the major OO methodologies, as does HP's new
  979. FUSION methodology.
  980.  
  981. The usual progression is from OOA to OOD to OOP (implementation) and this
  982. Universal Process Model roughly corresponds to the Waterfall Model [Royce 70].
  983. See [Humphrey 89] and [Yourdon 92] for a few of many discussions on software
  984. life-cycle models and their use.  Humphrey also details Worldy and Atomic
  985. Process Models for finer grained analysis and design in the Defined Process
  986. (see below) and discusses other alternatives to the task oriented models.  He
  987. also provides the following critisisms on the Waterfall Model which had led to
  988. Boehm's seminal work on the Spiral Model:
  989.  
  990.   * It does not adequately address changes
  991.   * It assumes a relatively uniform and orderly sequence of development steps
  992.   * It does not provide for such methods as rapid prototyping or advanced
  993.     languages
  994.  
  995. Modern OO methodologies directly address these points and emphasize the
  996. incremental, iterative, evolutionary, concurrent and situational nature of
  997. software development.  [Boehm 86] presents a seminal spiral life-cycle model
  998. with a risk-driven prototyping approach.  [Booch 91, 6.1] proposes a "round-
  999. trip gestalt" design with analyze-design iterations and an overall system
  1000. perspective and [Berard 93] proposes an (incremental) "parallel-recursive
  1001. design" with analyze-design-implement-test iterations.  [Coad 91b] presents
  1002. the following development cycle breakdown:
  1003.  
  1004.   Waterfall-
  1005.     Analysis
  1006.     Design
  1007.     Programming
  1008.  
  1009.   Spiral-
  1010.     Analysis, prototyping, risk management
  1011.     Design, prototyping, risk management
  1012.     Programming, prototyping, risk management
  1013.     [Boehm, 1988]  
  1014.  
  1015.   Incremental-
  1016.     A little analysis
  1017.     A little design
  1018.     A little programming
  1019.     Repeat
  1020.     [Gilb, 1988]
  1021.  
  1022. [Author's note: The spiral model may be incremental in many ways and ends with
  1023.  a waterfall.]
  1024.  
  1025. Since classes and objects are used in all phases of the OO software life-cycle,
  1026. the process is often referred to as seamless, meaning there is no conceptual
  1027. gap between the phases as is often the case in other software development
  1028. methodologies, such as the analysis (DFD's) to design (structure charts) to
  1029. programming gaps found in traditional structured analysis and design.
  1030. Seamlessness together with naturalness is a big advantage for consistency.
  1031.  
  1032. A problem domain has many realizations, or differing OOAs.  An OOA has many
  1033. realizations, or differing OODs, but a similar notation is often used for
  1034. the two.  An OOD also has many realizations, or differing OOPs, but allows a
  1035. selection from among various languages for implementation (choosing the best
  1036. language to implement the design).  But some, such as Bjarne Stroustrup, don't
  1037. like OOA and OOD getting too far from OOP (implementation independent), for
  1038. fear that great discrepancies could occur between OOD and OOP by losing sight
  1039. of the implementation language, which in some cases is predetermined.  See also
  1040. [Stroustrup 91].
  1041.  
  1042. From a greater perspective, the SEI has developed the Software Process Maturity
  1043. Model (SPMM), a 5 level model classifying the progressive levels of an
  1044. organization's software development [Humphrey 89].
  1045.  
  1046.  Level 1: Initial:    Every project is handled differently
  1047.  Level 2: Repeatable: Every project is handled similarly
  1048.  Level 3: Defined:    A standard process is now well defined for all projects
  1049.  Level 4: Managed:    A measurable basis for all improvements to the process
  1050.  Level 5: Optimizing: Emphasis on defect prevention and optimizing/continually
  1051.                       improving the process
  1052.  
  1053. See also [Yourdon 92], [Wilkie 93], and [Booch 94] for discussions on this
  1054. often cited model.  There is also an ISO 9000 standard on software quality.
  1055.  
  1056. Object-Oriented Information Engineering's "Enterprise Modeling" [Martin 92],
  1057. also found in [Jacobson 92], and some recent business "reengineering" efforts
  1058. place information systems within an organizational perspective by modeling
  1059. entire organizations or a large part of them, with the information processing
  1060. system and software products development as integrated components.  [Yourdon
  1061. 92] even calls for "global modeling"!
  1062.  
  1063.  
  1064. 1.22)  Where Did Object-Orientation Come From?
  1065. ----------------------------------------------
  1066.  
  1067. Simula was the first object-oriented language providing objects, classes,
  1068. inheritance, and dynamic typing in 1967 (in addition to its Algol-60 subset).
  1069. It was intended as a conveyance of object-oriented design.  Simula 1 was a
  1070. simulation language, and the later general-purpose language Simula 67 is now
  1071. referred to as simply Simula.  Smalltalk was the next major contributor
  1072. including classes, inheritance, a high-powered graphical environment and a
  1073. powerful dynamic typing mechanism (although these existed to some extent in
  1074. Simula).  Self is somewhat of a Smalltalk-based next generation language, as is
  1075. Beta a followup to Simula (by its original designers).
  1076.  
  1077. [Meyer 88] contains a brief summary and history of Simula and Smalltalk, among
  1078. other OO languages.
  1079.  
  1080.  
  1081. 1.23)  What Are The Benefits Of Object-Orientation?
  1082. ---------------------------------------------------
  1083.  
  1084. Reuse, quality, an emphasis on modeling the real world (or a "stronger
  1085. equivalence" with the RW than other methodologies), a consistent and seamless
  1086. OOA/OOD/OOP package, naturalness (our "object concept") and etc.
  1087.  
  1088. [Harmon 93]:
  1089.   Faster development
  1090.   Increased Quality
  1091.   Easier maintenance
  1092.   Enhanced modifiability
  1093.  
  1094. [Booch 94]:
  1095.   Exploit power of OOPs
  1096.   Reuse of software and designs, frameworks
  1097.   Systems more change resilient, evolvable
  1098.   Reduced development risks for complex systems, integration spread out
  1099.   Appeals to human cognition, naturalness
  1100.  
  1101.  
  1102. 1.24)  What Other FAQs Are Available?
  1103. -------------------------------------
  1104.  
  1105. FAQ's are cross-posted to news.answers and are archived on anonymous ftp from:
  1106.  
  1107.   rtfm.mit.edu:/pub/usenet        (also usenet-by-hierarchy, etc.)
  1108.  
  1109. rtfm archives several FAQs pertinent to OO (most are also archived elsewhere):
  1110.  
  1111.   comp.lang.ada         ajpo.sei.cmu.edu:public/comp-lang-ada/cla-faq[12]
  1112.   comp.lang.c++         sun.soe.clarkson.edu:pub/C++/FAQ [128.153.12.3]
  1113.   comp.lang.clos
  1114.   comp.lang.eiffel      ftp.cm.cf.ac.uk:/pub/eiffel/eiffel-faq
  1115.   comp.lang.oberon
  1116.   comp.lang.objective-c
  1117.   comp.lang.sather      ftp.ICSI.Berkeley.EDU:pub/sather [not on rtfm]
  1118.   comp.lang.scheme      ftp.think.com:/public/think/lisp/scheme-faq.text
  1119.   comp.lang.smalltalk   xcf.Berkeley.EDU:misc/smalltalk/FAQ/SmalltalkFAQ.entire
  1120.   comp.object           zaphod.uchicago.edu:/pub/comp.object-faq.1.0.5(.Z)
  1121.   comp.object.logic     ftp.cs.cmu.edu:*prg_1.faq,prg_2.faq  [128.2.206.173]
  1122.   comp.software-eng
  1123.  
  1124.   [xcf.Berkeley.EDU is 128.32.138.1]
  1125.   * /afs/cs.cmu.edu/project/ai-repository/ai/pubs/faqs/prolog/
  1126.  
  1127. A new C++ libraries FAQ is posted monthly to comp.lang.c++ and should be on
  1128. rtfm soon.  Contact cpplibs@trmphrst.demon.co.uk.  It contains anonymous ftp
  1129. sites and commercial libraries and may be merged with this FAQ soon.
  1130.  
  1131. Many FAQs are also available from mail-servers, however most can be accessed by
  1132. the rtfm mail-server.  Mail to mail-server@rtfm.mit.edu with help and index in
  1133. the body with no leading spaces and on separate lines for more information.
  1134.  
  1135. Example Unix Command (will retrieve this FAQ in about 26 pieces (and growing)):
  1136.   mail mail-server@rtfm.mit.edu
  1137.   Subject:
  1138.   send usenet/comp.object/*
  1139.  
  1140. There is also a great ftp site for sci.virtual-worlds on:
  1141.   stein.u.washington.edu (140.142.56.1)
  1142.           - home of sci.virtual-worlds, huge faq w/ great info!
  1143.           - if unable to use try ftp.u.washington.edu
  1144.           /public/virtual-worlds
  1145.  
  1146. [While vr may not be directly related to comp.object, it is most interesting!
  1147.    - The Author]
  1148.  
  1149.  
  1150. SECTION 2:  TYPING
  1151. ==================
  1152.  
  1153. There are many definitions of type (and class and related concepts).  Many
  1154. authors define the terms as applied by their particular approach or language,
  1155. however we shall proceed in the face of this diversity.
  1156.  
  1157.   References
  1158.     [Blair 89]          Some typing topics.
  1159.     [Booch 91]          Small Section on Typing.
  1160.     [Cardelli 85]       Discussion on Object-Oriented Typing.
  1161.     [Kim 89, ch1]       Discussion on Some Research Topics.
  1162.  
  1163.  
  1164. 2.1)  What Is Polymorphism?
  1165. ---------------------------
  1166.  
  1167. Polymorphism is a ubiquitous concept in object-oriented programming and is
  1168. defined in many ways, so many definitions are presented from: Websters',
  1169. Author, Strachey, Cardelli and Wegner, Booch, Meyer, Stroustrup, and Rumbaugh.
  1170. Polymorphism is often considered the most powerful facility of an OOPL.
  1171.  
  1172. > Webster's New World Dictionary:
  1173.  
  1174. Polymorphism 1. State or condition of being polymorphous.  2. Cryall.
  1175.   crystallization into 2 or more chemically identical but
  1176.   crystallographically distinct forms.  3.  Zool., Bot. existence of an
  1177.   animal or plant in several forms or color varieties.
  1178.  
  1179. polymorphous adj. having, assuming, or passing through many or various forms,
  1180.   stages, or the like.  Also, polymorphic. [<Gk polymorphous multiform]
  1181.  
  1182.  
  1183. > Author's Definition:
  1184.  
  1185. Polymorphism is the ability of an object (or reference) to assume (be replaced
  1186. by) or become many different forms of object.  Inheritance (or delegation)
  1187. specifies slightly different or additional structure or behavior for an object,
  1188. and these more specific or additional attributes of an object of a base class
  1189. (or type) when assuming or becoming an object of a derived class characterizes
  1190. object-oriented polymorphism.  This is a special case of parametric
  1191. polymorphism, which allows an object (or reference) to assume or become any
  1192. object (possibly satisfying some implicit or explicit type constraints
  1193. (parametric type), or a common structure), with this common structure being
  1194. provided by base classes or types (subclass and subtype polymorphism,
  1195. respectively).
  1196.